package com.gxa.web.ServiceManagement;

import com.alibaba.fastjson.JSONObject;
import com.gxa.common.JsonResult;
import com.gxa.service.ServiceService;
import com.gxa.service.impl.ServiceServiceImp;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

//查询服务归档信息
@WebServlet("/service/queryArchiving")
public class QueryServiceArchivingServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//layui开启分页 就有两个参数：page 当前页面  limit 每页显示条数
        Integer currentPage = Integer.parseInt(request.getParameter("page"));
        Integer pageSize = Integer.parseInt(request.getParameter("limit"));
        //调用ServiceService
        ServiceService serviceService = new ServiceServiceImp();
        JsonResult jsonResult = serviceService.queryServieArchivingList(currentPage,pageSize,null,null,0);
        //把jsonResult转成JSON格式数据，响应回给页面
        response.setContentType("application/json;charset=utf-8");
        response.getWriter().write(JSONObject.toJSONString(jsonResult));
    }
}
